home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_plotutils.idb / usr / freeware / include / plot.h.z / plot.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  10.2 KB  |  310 lines

  1. /* This is plot.h, the user-level include file for release 1.4 of
  2.    GNU libplot, a shared library for 2-dimensional vector graphics.  
  3.  
  4.    Release 1.4 of libplot, and this file, are distributed as part of
  5.    release 2.1.4 of the GNU plotting utilities ("plotutils") package. */
  6.  
  7. /* stdio.h must be included before this file is included. */
  8.  
  9. /* This file is written for ANSI C compilers.  If you use it with a
  10.    pre-ANSI C compiler that does not support the `const' keyword, such as
  11.    the `cc' compiler supplied with SunOS (i.e., Solaris 1.x), you should
  12.    use the -DNO_CONST_SUPPORT option when compiling your code. */
  13.  
  14. #ifndef _PLOT_H_
  15. #define _PLOT_H_ 1
  16.  
  17. /* support C++ */
  18. #ifdef __BEGIN_DECLS
  19. #undef __BEGIN_DECLS
  20. #endif
  21. #ifdef __END_DECLS
  22. #undef __END_DECLS
  23. #endif
  24. #ifdef __cplusplus
  25. # define __BEGIN_DECLS extern "C" {
  26. # define __END_DECLS }
  27. #else
  28. # define __BEGIN_DECLS        /* empty */
  29. # define __END_DECLS        /* empty */
  30. #endif
  31.      
  32. /* ___P is a macro used to wrap function prototypes, so that compilers that
  33.    don't understand ANSI C prototypes still work, and ANSI C compilers can
  34.    issue warnings about type mismatches. */
  35. #ifdef ___P
  36. #undef ___P
  37. #endif
  38. #if defined (__STDC__) || defined (_AIX) \
  39.     || (defined (__mips) && defined (_SYSTYPE_SVR4)) \
  40.     || defined(WIN32) || defined(__cplusplus)
  41. #define ___P(protos) protos
  42. #else
  43. #define ___P(protos) ()
  44. #endif
  45.  
  46. /* For old compilers (e.g. SunOS) */
  47. #ifdef ___const
  48. #undef ___const
  49. #endif
  50. #ifdef NO_CONST_SUPPORT
  51. #define ___const
  52. #else
  53. #define ___const const
  54. #endif
  55.  
  56. __BEGIN_DECLS
  57.  
  58. /* THE C API */
  59.  
  60. /* THE GLOBAL FUNCTIONS IN GNU LIBPLOT */
  61. /* There are 81 basic functions, plus 4 that are specific to the C binding */
  62.  
  63. /* 13 functions in traditional (pre-GNU) libplot */
  64. int arc ___P ((int xc, int yc, int x0, int y0, int x1, int y1));
  65. int box ___P ((int x0, int y0, int x1, int y1)); /* no op code, originally */
  66. int circle ___P ((int x, int y, int r));
  67. int closepl ___P ((void));    /* no op code, originally */
  68. int cont ___P ((int x, int y));
  69. int erase ___P ((void));
  70. int label ___P ((___const char *s));
  71. int line ___P ((int x0, int y0, int x1, int y1));
  72. int linemod ___P ((___const char *s));
  73. int move ___P ((int x, int y));
  74. int openpl ___P ((void));    /* no op code, originally */
  75. int point ___P ((int x, int y));
  76. int space ___P ((int x0, int y0, int x1, int y1));
  77.  
  78. /* 37 additional functions in GNU libplot */
  79. int alabel ___P ((int x_justify, int y_justify, ___const char *s));
  80. int arcrel ___P ((int dxc, int dyc, int dx0, int dy0, int dx1, int dy1));
  81. int bgcolor ___P ((int red, int green, int blue));
  82. int bgcolorname ___P ((___const char *name));
  83. int boxrel ___P ((int dx0, int dy0, int dx1, int dy1));
  84. int capmod ___P ((___const char *s));
  85. int circlerel ___P ((int dx, int dy, int r));
  86. int color ___P ((int red, int green, int blue));
  87. int colorname ___P ((___const char *name));
  88. int contrel ___P ((int x, int y));
  89. int ellarc ___P ((int xc, int yc, int x0, int y0, int x1, int y1));
  90. int ellarcrel ___P ((int dxc, int dyc, int dx0, int dy0, int dx1, int dy1));
  91. int ellipse ___P ((int x, int y, int rx, int ry, int angle));
  92. int ellipserel ___P ((int dx, int dy, int rx, int ry, int angle));
  93. int endpath ___P((void));
  94. int filltype ___P ((int level));
  95. int fillcolor ___P ((int red, int green, int blue));
  96. int fillcolorname ___P ((___const char *name));
  97. int flushpl ___P ((void));
  98. int fontname ___P ((___const char *s));
  99. int fontsize ___P ((int size));
  100. int havecap ___P ((___const char *s));
  101. int joinmod ___P ((___const char *s));
  102. int labelwidth ___P ((___const char *s));
  103. int linerel ___P ((int dx0, int dy0, int dx1, int dy1));
  104. int linewidth ___P ((int size));
  105. int marker ___P ((int x, int y, int type, int size));
  106. int markerrel ___P ((int dx, int dy, int type, int size));
  107. int moverel ___P ((int x, int y));
  108. FILE* outfile ___P((FILE* newstream));
  109. int pencolor ___P ((int red, int green, int blue));
  110. int pencolorname ___P ((___const char *name));
  111. int pointrel ___P ((int dx, int dy));
  112. int restorestate ___P((void));
  113. int savestate ___P((void));
  114. int space2 ___P ((int x0, int y0, int x1, int y1, int x2, int y2));
  115. int textangle ___P ((int angle));
  116.  
  117. /* 27 floating point counterparts to some of the above (all GNU additions) */
  118. double ffontname ___P ((___const char *s));
  119. double ffontsize ___P ((double size));
  120. double flabelwidth ___P ((___const char *s));
  121. double ftextangle ___P ((double angle));
  122. int farc ___P ((double xc, double yc, double x0, double y0, double x1, double y1));
  123. int farcrel ___P ((double dxc, double dyc, double dx0, double dy0, double dx1, double dy1));
  124. int fbox ___P ((double x0, double y0, double x1, double y1));
  125. int fboxrel ___P ((double dx0, double dy0, double dx1, double dy1));
  126. int fcircle ___P ((double x, double y, double r));
  127. int fcirclerel ___P ((double dx, double dy, double r));
  128. int fcont ___P ((double x, double y));
  129. int fcontrel ___P ((double x, double y));
  130. int fellarc ___P ((double xc, double yc, double x0, double y0, double x1, double y1));
  131. int fellarcrel ___P ((double dxc, double dyc, double dx0, double dy0, double dx1, double dy1));
  132. int fellipse ___P ((double x, double y, double rx, double ry, double angle));
  133. int fellipserel ___P ((double dx, double dy, double rx, double ry, double angle));
  134. int fline ___P ((double x0, double y0, double x1, double y1));
  135. int flinerel ___P ((double dx0, double dy0, double dx1, double dy1));
  136. int flinewidth ___P ((double size));
  137. int fmarker ___P ((double x, double y, int type, double size));
  138. int fmarkerrel ___P ((double dx, double dy, int type, double size));
  139. int fmove ___P ((double x, double y));
  140. int fmoverel ___P ((double x, double y));
  141. int fpoint ___P ((double x, double y));
  142. int fpointrel ___P ((double dx, double dy));
  143. int fspace ___P ((double x0, double y0, double x1, double y1));
  144. int fspace2 ___P ((double x0, double y0, double x1, double y1, double x2, double y2));
  145.  
  146. /* 4 floating point operations with no integer counterpart (GNU additions) */
  147. int fconcat ___P ((double m0, double m1, double m2, double m3, double m4, double m5));
  148. int frotate ___P ((double theta));
  149. int fscale ___P ((double x, double y));
  150. int ftranslate ___P ((double x, double y));
  151.  
  152. /* 4 functions specific to the C binding (for construction/destruction of
  153.    Plotters, and setting of Plotter parameters ) */
  154. int newpl ___P((___const char *type, FILE *instream, FILE *outstream, FILE *errstream));
  155. int selectpl ___P ((int handle));
  156. int deletepl ___P ((int handle));
  157. #ifdef NO_VOID_SUPPORT
  158. int parampl ___P ((___const char *parameter, char *value));
  159. #else
  160. int parampl ___P ((___const char *parameter, void *value));
  161. #endif
  162.  
  163. __END_DECLS
  164.  
  165. /* THE GLOBAL VARIABLES IN GNU LIBPLOT */
  166. /* There are two; both are user-settable error handlers. */
  167. extern int (*libplot_warning_handler) ___P ((___const char *msg));
  168. extern int (*libplot_error_handler) ___P ((___const char *msg));
  169.  
  170. #undef ___const
  171. #undef ___P
  172.  
  173. /* A temporary kludge.  In plotutils-2.0, endpoly() and fill() were renamed
  174.    endpath() and filltype().  Also, falabel() and the undocumented function
  175.    dot() were dropped, and the return value for alabel() was changed.  We
  176.    can't do anything to work around the latter changes, but for the next
  177.    couple of releases we'll at least support the old names endpoly() and
  178.    fill() by including the following preprocessor definitions. */
  179.  
  180. #ifndef endpoly
  181. #define endpoly() endpath()
  182. #endif
  183. #ifndef fill
  184. #define fill(arg) filltype(arg)
  185. #endif
  186.  
  187. /* symbol types for the marker() function, 1 through 5 are as in GKS */
  188.  
  189. #define M_NONE 0
  190. #define M_DOT 1
  191. #define M_PLUS 2
  192. #define M_ASTERISK 3
  193. #define M_CIRCLE 4
  194. #define M_CROSS 5
  195. #define M_SQUARE 6
  196. #define M_TRIANGLE 7
  197. #define M_DIAMOND 8
  198. #define M_STAR 9
  199. #define M_INVERTED_TRIANGLE 10
  200. #define M_STARBURST 11
  201. #define M_FANCY_PLUS 12
  202. #define M_FANCY_CROSS 13
  203. #define M_FANCY_SQUARE 14
  204. #define M_FANCY_DIAMOND 15
  205. #define M_FILLED_CIRCLE 16
  206. #define M_FILLED_SQUARE 17
  207. #define M_FILLED_TRIANGLE 18
  208. #define M_FILLED_DIAMOND 19
  209. #define M_FILLED_INVERTED_TRIANGLE 20
  210.  
  211. #define M_FILLED_FANCY_SQUARE 21
  212. #define M_FILLED_FANCY_DIAMOND 22
  213. #define M_HALF_FILLED_CIRCLE 23
  214. #define M_HALF_FILLED_SQUARE 24
  215. #define M_HALF_FILLED_TRIANGLE 25
  216. #define M_HALF_FILLED_DIAMOND 26
  217. #define M_HALF_FILLED_INVERTED_TRIANGLE 27
  218. #define M_HALF_FILLED_FANCY_SQUARE 28
  219. #define M_HALF_FILLED_FANCY_DIAMOND 29
  220. #define M_OCTAGON 30
  221. #define M_FILLED_OCTAGON 31
  222.  
  223.  
  224. /* ONE-BYTE OP CODES FOR GNU METAFILE FORMAT */
  225. /* There are currently 71, including 25 that are used only in binary
  226.    metafiles, not in portable metafiles. */
  227.  
  228. /* 10 op codes for primitive graphics operations, as in Unix plot(5) format. */
  229. #define ARC        'a'
  230. #define CIRCLE        'c'
  231. #define CONT        'n'
  232. #define ERASE        'e'
  233. #define LABEL        't'
  234. #define LINEMOD        'f'
  235. #define LINE        'l'
  236. #define MOVE        'm'
  237. #define POINT        'p'
  238. #define SPACE        's'
  239.  
  240. /* 32 op codes that are GNU extensions [plus an obsolete one] */
  241. #define ALABEL        'T'
  242. #define ARCREL        'A'
  243. #define BGCOLOR        '~'
  244. #define BOX        'B'    /* not a separate op code in Unix plot(5) */
  245. #define BOXREL        'H'
  246. #define CAPMOD        'K'
  247. #define CIRCLEREL    'G'
  248. #define CLOSEPL        'x'
  249. #define COLOR        'C'    /* obsolete, to be removed */
  250. #define COMMENT        '#'
  251. #define CONTREL        'N'
  252. #define ELLARC        '?'
  253. #define ELLARCREL    '/'
  254. #define ELLIPSE        '+'
  255. #define ELLIPSEREL    '='
  256. #define ENDPATH        'E'
  257. #define FILLTYPE    'L'
  258. #define FILLCOLOR    'D'
  259. #define FONTNAME    'F'
  260. #define FONTSIZE    'S'
  261. #define JOINMOD        'J'
  262. #define LINEREL        'I'
  263. #define LINEWIDTH    'W'
  264. #define MARKER        'Y'
  265. #define MARKERREL    'Z'
  266. #define MOVEREL        'M'
  267. #define OPENPL        'o'
  268. #define PENCOLOR    '-'
  269. #define POINTREL    'P'
  270. #define RESTORESTATE    'O'
  271. #define SAVESTATE    'U'
  272. #define SPACE2        ':'
  273. #define TEXTANGLE    'R'
  274.  
  275. /* 25 floating point counterparts to some of the above.  Used only in
  276.    binary GNU metafile format, not in portable GNU metafile format. */
  277. #define FARC        '1'
  278. #define FARCREL        '2'
  279. #define FBOX        '3'
  280. #define FBOXREL        '4'
  281. #define FCIRCLE        '5'
  282. #define FCIRCLEREL    '6'
  283. #define FCONT        ')'
  284. #define FCONTREL    '_'
  285. #define FELLARC        '}'
  286. #define FELLARCREL    '|'
  287. #define FELLIPSE    '{'
  288. #define FELLIPSEREL    '['
  289. #define FFONTSIZE    '7'
  290. #define FLINE        '8'
  291. #define FLINEREL    '9'
  292. #define FLINEWIDTH    '0'
  293. #define FMARKER        '!'
  294. #define FMARKERREL    '@'
  295. #define FMOVE        '$'
  296. #define FMOVEREL    '%'
  297. #define FPOINT        '^'
  298. #define FPOINTREL    '&'
  299. #define FSPACE        '*'
  300. #define FSPACE2        ';'
  301. #define FTEXTANGLE    '('
  302.  
  303. /* 4 op codes for floating point operations with no integer counterpart */
  304. #define FCONCAT        '\\'
  305. #define FROTATE        'V'
  306. #define FSCALE        'X'
  307. #define FTRANSLATE    'Q'
  308.  
  309. #endif /* _PLOT_H_ */
  310.